//
//  CJGMAdaterManager.m
//  CJModileGMAdapter
//
//  Created by shanghailingye on 2024/4/24.
//

#import "CJToBidAdaterManager.h"

@interface CJToBidAdaterManager()

@property (nonatomic, weak) id<AWMCustomConfigAdapterBridge> bridge;

@end

static BOOL isSetup = NO;

@implementation CJToBidAdaterManager

- (instancetype)initWithBridge:(id<AWMCustomConfigAdapterBridge>)bridge {
    self = [super init];
    if (self) {
        _bridge = bridge;
    }
    return self;
}
- (AWMCustomAdapterVersion *)basedOnCustomAdapterVersion {
    return AWMCustomAdapterVersion1_0;
}

- (NSString *)adapterVersion {
    return ADAPTER_VERSION;
}

- (NSString *)networkSdkVersion {
    return [CJADManager version];
}

- (void)initializeAdapterWithConfiguration:(AWMSdkInitConfig *)initConfig {
    [CJADManager openDebugLog];
    [CJADManager configure:initConfig.extra[@"appid"] completeHandle:^(BOOL success, NSError * _Nullable error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            NSLog(@"lingye-%@", success ? @"初始化成功" : @"初始化失败，请检查配置");
            if (success) {
                [self.bridge initializeAdapterSuccess:self];
            } else {
                [self.bridge initializeAdapterFailed:self error:error];
            }
        });
    }];
}
/// 隐私权限更新，用户更新隐私配置时触发，初始化方法调用前一定会触发一次
- (void)didRequestAdPrivacyConfigUpdate:(NSDictionary *)config {
    //调用三方adn隐私设置接口
}

@end
